package com.attendance.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.attendance.entity.ApplyLeave;

@Repository
public interface ApplyLeaveRepository extends PagingAndSortingRepository<ApplyLeave, Long>, JpaSpecificationExecutor<ApplyLeave>
{
	@Query(value="from ApplyLeave a where a.staff.staffName like %?1%")
	public List<ApplyLeave> findLikeStaffName(String name);
	@Query(value="from ApplyLeave a where a.staff.staffNum like %?1%")
	public List<ApplyLeave> findLikeStaffNum(String num);
	@Query(value="from ApplyLeave a where a.staff.id = ?1")
	public List<ApplyLeave> findByStaffId(Long staffId);
	@Query(value="from ApplyLeave a where a.staff.department.id = ?1")
	public List<ApplyLeave> findByInstitute(Long instituteId);
}
